//
//  UIView+GradientColor.h
//  Pods
//
//  Created by Apple on 2022/11/4.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN


typedef NS_ENUM(NSInteger, YCGradientColorDirection) {
    YCGradientColorDirectionHorizonal               = 0,    //水平方向
    YCGradientColorDirectionVertical                = 1,    //竖直方向
    YCGradientColorDirectionTopLeftToBottomRight    = 2,    //左上 - 右下 斜向
    YCGradientColorDirectionTopRightToBottomLeft    = 3,    //右上 - 左下 斜向
};

typedef NS_OPTIONS(NSUInteger, YCGradientColorState) {
    YCGradientColorStateNormal       = 1 << 0,
    YCGradientColorStateDisabled     = 1 << 1,
};

@interface UIView (GradientColor)

@property (nonatomic, strong) NSArray<NSNumber *> *gradientColorLocations;      //渐变位置，要与渐变色颜色个数一致
@property (nonatomic, assign) CGPoint gradientColorStartPoint;                  //渐变方向，与 gradientColorEndPoint 配合使用
@property (nonatomic, assign) CGPoint gradientColorEndPoint;                    //渐变方向，与 gradientColorStartPoint 配合使用
@property (nonatomic, assign) YCGradientColorDirection gradientColorDirection;  //渐变方向，相当于同时设置 gradientColorStartPoint 和 gradientColorEndPoint，同时前面设置的gradientColorStartPoint和gradientColorEndPoint将失效   默认：YCGradientColorDirection_Horizonal

@property (nonatomic, assign) BOOL gradientEnabled;      //背景样式，需设置上述相关参数才会生效

/// 设置背景色
/// @param colors 渐变颜色数组
/// @param state 状态
- (void)setGradientColors:(NSArray<UIColor *> *)colors forState:(YCGradientColorState)state;

/**
 *  添加渐变背景图层
 *  @param colors    - 渐变颜色
 *  @param direction - 渐变方向，详见枚举：FCGradientDirection
 */
- (void)addGradientColorWithColors:(NSArray<UIColor *> *)colors direction:(YCGradientColorDirection)direction;

/**
 *  添加渐变背景图层
 *  @param colors       - 渐变颜色
 *  @param startPoint   - aaa
 *  @param endPoint     - bbb
 */
- (void)addGradientColorWithColors:(NSArray<UIColor *> *)colors startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint;

@end


@interface UIImageView (GradientColor)

@end




#pragma mark - UIButton (GradientBg)

@interface UIButton (GradientColor)

@end


NS_ASSUME_NONNULL_END
